<template>
  <view class="list-components">
    <view class="top-box">
      <view class="active-box"></view>
      <view class="text1">{{ showData.salesType }}</view>
      <view class="text2">
        <text>{{ showData.brand }}</text>
        <text class="iconfont icon-weibiaoti--10"></text>
      </view>
    </view>
    <view
      class="bottom-box"
      :class="item.discountTime ? 'addmb' : ''"
      v-for="item in showData.list"
      :key="item.id"
    >
      <view class="active-box"></view>
      <view class="left-content">
        <image :src="item.imageUrl" mode="aspectFill"></image>
        <text class="remaining-text" v-if="item.remaining">{{
          item.remaining
        }}</text>

        <view class="discount-box" v-if="item.discountTime"
          >优惠剩
          <text class="discount-text">{{ item.discountTime }}</text>
        </view>
      </view>
      <view class="right-content">
        <view class="title-text">{{ item.title }}</view>
        <view class="parameter-box">
          <view class="parameter-text"
            >{{ item.parameter }}
            <text class="iconfont icon-weibiaoti--10"></text
          ></view>
          <view class="num-text"
            >1 <text class="iconfont icon-weibiaoti--10"></text
          ></view>
        </view>
        <view class="other-text"> 10天保价 </view>
        <view class="rank-box" v-if="item.rank">
          <text class="rank-text">{{ item.rank }} </text>
        </view>
        <view class="price-box">
          <text class="price-text">
            <text class="rmb-text">¥</text>
            <text class="price-num">{{ item.price }}</text>
          </text>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import { defineComponent, reactive, toRefs } from "vue";
export default defineComponent({
  name: "",
  props: {
    showData: {
      type: Object,
      default: () => {
        return {
          salesType: "自营",
          brand: "彪马",
          list: [
            {
              id: 1,
              title: "Nike SB Alleyoop 复古休闲 低帮 板鞋 男款 黄灰色",
              price: "149",
              oldPrice: "199",
              discount: "1.5折",
              imageUrl: "/static/dataImage/weipinhui/001.webp",
              rank: "入选 No.18-运动潮流男外套榜",
              inventory: true,
              parameter: "白/黑：46",
              inventoryText: "剩：M | L码",
              discountTime: "",
              remaining: "仅剩8件",
            },
            {
              id: 4,
              title: "MOTIVA 实战训练 女子全能鞋",
              price: "244",
              discount: "5.5折",
              oldPrice: "359",
              imageUrl: "/static/dataImage/weipinhui/009.webp",
              rank: "",
              inventory: true,
              inventoryText: "剩：M码",
              parameter: "白/黑：46",
              inventoryText: "剩：M | L码",
              discountTime: "24:26:38",
              remaining: "",
            },
          ],
        };
      },
    },
  },
  components: {},
  setup() {
    const data = reactive({});
    return {
      ...toRefs(data),
    };
  },
});
</script>

<style scoped lang="less">
.list-components {
  display: flex;
  flex-direction: column;
  background: #fff;
  padding: 20rpx 30rpx;
  border-radius: 15rpx;

  .top-box {
    display: flex;
    flex-direction: row;
    align-items: center;
    margin-bottom: 20rpx;
    .active-box {
      width: 30rpx;
      height: 30rpx;
      border: 3rpx solid #a9a9a9;
      border-radius: 50%;
      margin-right: 10rpx;
    }
    .text1 {
      font-size: 20rpx;
      background: #fcecf4;
      color: #ff0777;
      height: 30rpx;
      line-height: 30rpx;
      margin: 0 12rpx;
    }
    .text2 {
      color: #565656;
      height: 30rpx;
      line-height: 30rpx;
      font-size: 26rpx;
      display: flex;
      flex-direction: row;
      align-items: center;

      .icon-weibiaoti--10 {
        display: block;
        transform: rotate(180deg);
        font-size: 24rpx;
        margin-left: 6rpx;
        line-height: 30rpx;
        margin-top: -2rpx;
      }
    }
  }
  .bottom-box {
    display: flex;
    flex-direction: row;
    align-items: start;
    margin-bottom: 30rpx;
    &.addmb {
      margin-bottom: 50rpx;
    }
    .active-box {
      width: 30rpx;
      height: 30rpx;
      border: 3rpx solid #a9a9a9;
      border-radius: 50%;
      margin-right: 10rpx;
      margin-top: 80rpx;
    }
    .left-content {
      width: 180rpx;
      height: 180rpx;
      position: relative;
      image {
        display: block;
        border-radius: 10rpx;
        width: 100%;
        height: 100%;
        overflow: hidden;
        z-index: 1;
      }
      .remaining-text {
        position: absolute;
        width: 100rpx;
        z-index: 2;
        height: 30rpx;
        border-radius: 6rpx;
        line-height: 28rpx;
        text-align: center;
        bottom: 10rpx;
        padding: 4rpx 5rpx;
        left: 50%;
        font-size: 22rpx;
        transform: translateX(-50%);
        background: #ff0777;
        color: #fff;
      }
      .discount-box {
        text-align: center;
        position: absolute;
        bottom: -30rpx;
        font-size: 20rpx;
        padding: 3rpx 10rpx;
        padding-top: 15rpx;
        width: 100%;
        box-sizing: border-box;
        background: #f5f5f5;
        color: #525252;
        border-radius: 0 0 10rpx 10rpx;
        .discount-text {
          color: #ff0777;
        }
      }
    }
    .right-content {
      flex: 1;
      display: flex;
      flex-direction: column;
      padding-left: 20rpx;
      .title-text {
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 26rpx;
      }
      .price-box {
        display: flex;
        flex-direction: row;
        justify-content: start;
        align-items: center;
        margin-top: 25rpx;
        .price-text {
          line-height: 22rpx;
          color: #ff0777;
          .rmb-text {
            font-size: 32rpx;
            font-weight: 700;
          }
          .price-num {
            font-size: 32rpx;
            font-weight: 700;
          }
        }
      }
      .other-text {
        color: #5a8dd5;
        font-size: 22rpx;
        margin-top: 12rpx;
      }
      .rank-box {
        margin-top: 10rpx;
        .rank-text {
          color: #a8560a;
          background: #fef3ec;
          font-size: 22rpx;
          border-radius: 10rpx;
          padding: 4rpx 15rpx;
        }
      }
      .parameter-box {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: 15rpx;
        .parameter-text {
          font-size: 22rpx;
          color: #888888;
          background: #f4f4f4;
          padding: 5rpx 10rpx;
          border-radius: 6rpx;
          .icon-weibiaoti--10 {
            display: inline-block;
            font-size: 24rpx;
            transform: rotate(-90deg);
          }
        }
        .num-text {
          border: 2rpx solid #c3c3c3;
          font-size: 22rpx;
          padding: 5rpx 10rpx;
          border-radius: 6rpx;
          .icon-weibiaoti--10 {
            display: inline-block;
            font-size: 20rpx;
            transform: rotate(-90deg);
          }
        }
      }
    }
  }
}
</style>
